#!/usr/bin/env node

const Koa = require('koa');

const app = new Koa();

app.use(async (ctx,next)=>{  //M-logger
  const start = Date.now();
  await next();
  const end = Date.now();
  console.log(`${ctx.method} ${ctx.path}  -${end-start}ms`)
})

app.use((ctx,next)=>{  //M-hello
  setTimeout(()=>{
    ctx.body = 'hello world'
  },2000);
});
app.listen(3000);
